package com.attilax.ui;

import java.io.File;
import java.util.prefs.Preferences;

import javax.swing.JFileChooser;
import javax.swing.JLabel;

 
import chrriis.common.UIUtils;
import chrriis.dj.nativeswing.swtimpl.components.JWebBrowser;

import com.attilax.io.filex;
import com.attilax.io.pathx;

public class FileSelector {
 

	public Object exe( ) {
		
		UIUtils.setPreferredLookAndFeel();
		String saveFolder = "C:\\";
		Preferences pref = Preferences.userRoot().node(
				this.getClass().getName());
		String lastPath = pref.get("lastPath", "");
		JFileChooser jfc = null;
		if (!lastPath.equals(""))
			jfc = new JFileChooser(lastPath);
		else
			jfc = new JFileChooser();

		jfc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
		jfc.showDialog(new JLabel(), "select file 选择");
		File file = jfc.getSelectedFile();
		saveFolder = jfc.getSelectedFile().getPath();
		pref.put("lastPath", saveFolder);
		if (file.isDirectory()) {
			System.out.println("文件夹:" + file.getAbsolutePath());
		} else if (file.isFile()) {
			System.out.println("文件aa2:" + file.getAbsolutePath());
			return file.getAbsolutePath();

		}
		return file;
		
	}

 
 

}
